#!/bin/bash

DATA_MYSQL_DIR=data/mysql

DC_MYSQL_NAME=harbor-dev-mysql

function prepare-dev-env() {
  mkdir -pv $DATA_MYSQL_DIR

  docker kill $DC_MYSQL_NAME
  docker rm   $DC_MYSQL_NAME
  docker run --name $DC_MYSQL_NAME \
             -v "$PWD/$DATA_MYSQL_DIR":/var/lib/mysql \
             -v "$PWD/src/main/sql":/docker-entrypoint-initdb.d \
             -p 23306:3306 \
             -e MYSQL_ROOT_PASSWORD=root \
             -d mysql:5.7.22
}

function clean-dev-env() {
  docker kill $DC_MYSQL_NAME
  docker rm   $DC_MYSQL_NAME
}

prepare-dev-env